package com.nbsaas.boot.evaluate.rest.convert;

import com.nbsaas.boot.entity.evaluate.EvaluateCatalog;
import com.nbsaas.boot.evaluate.api.domain.request.EvaluateCatalogRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.entity.evaluate.EvaluateCatalog;

/**
* 评价分类请求对象转换成实体对象
*/

public class EvaluateCatalogEntityConvert  implements Converter<EvaluateCatalog, EvaluateCatalogRequest> {

    @Override
    public EvaluateCatalog convert(EvaluateCatalogRequest source) {
        EvaluateCatalog result = new EvaluateCatalog();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                    EvaluateCatalog parent =new EvaluateCatalog();
                    parent.setId(source.getParent());
                    result.setParent(parent);
                    }
        return result;
    }
}

